# encoding: utf-8
import random
lst = [random.randint(1,20) for i in range(20)]
a = {}
for i in range(20):
    # 这一段的处理和fourth一样的
    if lst[i] in a:
        a.update({lst[i]:a.get(lst[i])+1})
    else:
        a.setdefault(lst[i],1)
a = sorted(a.items(), key = lambda item:item[1],reverse = True)
for k in range(3):
    print('数字:{}次数：{}'.format(a[k][0],a[k][1]))
